package model

import (
	"food-mgr/food-service/configs"
	"gorm.io/gorm"
)

type Eval struct {
	gorm.Model
	UserId  int     `gorm:"type:int(11);comment:用户ID"`
	ShopId  int     `gorm:"type:int(11);comment:商品ID"`
	BizId   int     `gorm:"type:int(11);comment:商家ID"`
	Score   float64 `gorm:"type:decimal(10,2);comment:评价分数"`
	Context string  `gorm:"type:varchar(30);comment:评价内容"`
}

func CreateEval(e *Eval) error {

	return configs.DB.Create(&e).Error
}
func ListEval(e *[]Eval, bizId int) error {

	return configs.DB.Where("biz_id=?", bizId).Find(&e).Error
}
